// 工单路由
export default [
  {
    path: '/createOrder',
    name: 'CreateOrder',
    meta: {
      hidden: false,
      title: '工单创建',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/createOrder'),
    beforeEnter: (to, from, next) => {
      if (to.query.id || to.query.workOrderNo) {
        to.meta.title = '工单编辑'
      } else {
        to.meta.title = '工单创建'
      }
      next()
    },
    props: route => {
      if (route.query.taskData) {
        try {
          const t = window.decodeURIComponent(route.query.taskData)
          const t1 = window.decodeURIComponent(route.query.visitForm)
          return {
            taskData: JSON.parse(t),
            recordId: route.query.recordId || '',
            visitForm: JSON.parse(t1),
            isTask: true
          }
        } catch (error) {
          return {}
        }
      } else {
        return {}
      }
    }
  },
  {
    path: '/assignOrder',
    name: 'AssignOrder',
    meta: {
      hidden: false,
      title: '批量派单',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/assignOrder')
  },
  {
    path: '/disposeOrder',
    name: 'DisposeOrder',
    meta: {
      hidden: false,
      title: '工单处理',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/disposeOrder')
  },
  {
    path: '/disposeOrder/details',
    name: 'DisposeOrderDetails',
    meta: {
      hidden: false,
      title: '工单详情',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/disposeOrder/details')
  },
  {
    path: '/queryOrder',
    name: 'QueryOrder',
    meta: {
      hidden: false,
      title: '工单查询',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/queryOrder')
  },
  {
    path: '/queryOrder/details',
    name: 'QueryOrderDetails',
    meta: {
      hidden: false,
      title: '查询-工单详情',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/queryOrder/details')
  },
  {
    path: '/afterSaleRecord',
    name: 'AfterSaleRecord',
    meta: {
      hidden: false,
      title: '门店售后档案管理',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/afterSaleRecord')
  },
  {
    path: '/officeArchive',
    name: 'OfficeArchive',
    meta: {
      hidden: false,
      title: '办事处售后档案管理',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/officeArchive')
  },
  {
    path: '/afterSaleRecord/details',
    name: 'AfterSaleRecordDetails',
    meta: {
      hidden: false,
      title: '门店售后档案管理详情',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/afterSaleRecord/details')
  },
  {
    path: '/setting/contentRel',
    name: 'ContentRel',
    meta: {
      hidden: false,
      title: '业务类型与责任部门关系配置表',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/setting/contentRel')
  },
  {
    path: '/setting/channelRel',
    name: 'ChannelRel',
    meta: {
      hidden: false,
      title: '购买渠道与业务类型关系配置表',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/setting/channelRel')
  },
  {
    path: '/setting/respDepartment',
    name: 'RespDepartment',
    meta: {
      hidden: false,
      title: '责任部门接收人信息维护表',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/setting/respDepartment')
  },
  {
    path: '/otherOrder',
    name: 'otherOrder',
    meta: {
      hidden: false,
      title: '责任部门服务工单',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/otherOrder')
  },
  {
    path: '/otherOrder/details',
    name: 'otherOrderDetails',
    meta: {
      hidden: false,
      title: '责任部门服务工单详情',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/otherOrder/details')
  },
  {
    path: '/officeOrder',
    name: 'officeOrder',
    meta: {
      hidden: false,
      title: '办事处服务工单',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/officeOrder')
  },
  {
    path: '/officeOrder/details',
    name: 'officeOrderDetails',
    meta: {
      hidden: false,
      title: '办事处服务工单详情',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/otherOrder/details')
  },
  {
    path: '/distributeLogicConfig',
    name: 'DistributionLogicConfig',
    meta: {
      hidden: false,
      title: '派单逻辑配置表',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/distributionLogicConfig')
  },
  {
    path: '/ecRecipientConfig',
    name: 'ECRecipientConfig',
    meta: {
      hidden: false,
      title: '工单接收人配置表',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/ecRecipientConfig')
  },
  {
    path: '/elementCombine',
    name: 'ElementCombine',
    meta: {
      hidden: false,
      title: '派单逻辑因子组合配置表',
      icon: 'caidan-tubiaoku'
    },
    component: () => import('@/views/workOrder/elementCombine')
  }
]
